﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using pay.DAL;

/// <summary>
///Web_VedioBLL 的摘要说明
/// </summary>
public class Web_VedioBLL
{
    Web_videoDAL web_videoDAL = new Web_videoDAL();

    /// <summary>
    /// 得到最近的视频
    /// </summary>
    /// <returns>视频对象</returns>
    public Web_video GetNeareastVideo()
    {
        return web_videoDAL.GetNeareastVideo();
    }
    private DataTable mjjp;
    /// <summary>
    ///名家解盘
    /// </summary>
    public DataTable Mjjp
    {
        get
        {
            if (mjjp != null)
            {
                return mjjp;
            }
            VideoQuery query = new VideoQuery();
            query.Sign = 3;
            query.Classid = 89;
            mjjp = web_videoDAL.GetVieoByParam(query);
            return mjjp;
        }
    }
    private DataTable zxjc;
    /// <summary>
    /// 最新教程
    /// </summary>
    public DataTable Zxjc
    {
        get
        {
            if (zxjc != null)
            {
                return zxjc;
            }
            VideoQuery query = new VideoQuery();
            query.Sign = 5;

            zxjc = web_videoDAL.GetVieoByParam(query);
            return zxjc;
        }
    }
    private DataTable xsbk;
    /// <summary>
    /// 新手必看
    /// </summary>
    public DataTable Xsbk
    {
        get
        {
            if (xsbk != null)
            {
                return xsbk;
            }
            VideoQuery query = new VideoQuery();
            query.Sign = 4;
            query.Classid = 88;
            xsbk = web_videoDAL.GetVieoByParam(query);
            return xsbk;
        }
    }

    private DataTable yzln;
    /// <summary>
    /// 赢在理念
    /// </summary>
    public DataTable Yzln
    {
        get
        {
            if (yzln != null)
            {
                return yzln;
            }
            VideoQuery query = new VideoQuery();
            query.Sign = 4;
            query.Classid = 84;
            query.Topnum = 6;
            yzln = web_videoDAL.GetVieoByParam(query);
            return yzln;
        }
    }

    private DataTable szjq;
    /// <summary>
    /// 实战技巧
    /// </summary>
    public DataTable Szjq
    {
        get
        {
            if (szjq != null)
            {
                return szjq;
            }
            VideoQuery query = new VideoQuery();
            query.Sign = 4;
            query.Classid = 83;
            szjq = web_videoDAL.GetVieoByParam(query);
            return szjq;
        }
    }
    private DataTable tjkc;
    /// <summary>
    /// 推荐课程
    /// </summary>
    public DataTable Tjkc
    {
        get
        {
            if (tjkc != null)
            {
                return tjkc;
            }
            VideoQuery query = new VideoQuery();
            query.Sign = 5;
            tjkc = web_videoDAL.GetVieoByParam(query);
            return tjkc;
        }
    }
    private DataTable jrjp;
    /// <summary>
    /// 今日解盘
    /// </summary>
    public DataTable Jrjp
    {
        get
        {
            if (jrjp != null)
            {
                return jrjp;
            }
            VideoQuery query = new VideoQuery();
            query.Sign = 3;
            query.Topnum = 5;
            jrjp = web_videoDAL.GetVieoByParam(query);
            return jrjp;
        }
    }

    /// <summary>
    /// 根据视频主键得到视频内容
    /// </summary>
    /// <param name="id">主键编号</param>
    /// <returns>视频内容</returns>
    public DataRow GetVideoById(int id)
    {
        VideoQuery query = new VideoQuery();
        query.Sign = 2;
        query.V_id = id;
        return web_videoDAL.GetVieoByParam(query).Rows[0];
    }

    /// <summary>
    /// 得到相关视频
    /// </summary>
    /// <param name="classid">类型编号</param>
    /// <returns>视频集合</returns>
    public DataTable GetVideoRelated(int id)
    {
        DataRow row = GetVideoById(id);
        int classid = Tools.GetInt(row["classid"]).Value;
        VideoQuery query = new VideoQuery();
        query.Sign = 4;
        query.Classid = classid;
        query.Topnum = 8;
        return web_videoDAL.GetVieoByParam(query);
    }
}